package leetcode.code1629;

import leetcode.IDebug;

public class Solution implements IDebug {

	public char slowestKey(int[] releaseTimes, String keysPressed) {
		char ans = keysPressed.charAt(0);
		int max = releaseTimes[0];
		int last = max;
		int diff = 0;
		char c = keysPressed.charAt(0);
		for (int i = 1; i < releaseTimes.length; i++) {
			int cur = releaseTimes[i];
			if ((diff = cur - last) > max) {
				max = diff;
				ans = keysPressed.charAt(i);
			} else if (diff == max && (c = keysPressed.charAt(i)) > ans) {
				ans = c;
			}
			last = cur;
		}
		return ans;
	}

	@Override
	public void debug1() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug2() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug3() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug4() {
		// TODO Auto-generated method stub

	}

	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}

}
